exports.getTime = () => { 
  const timestamp = Date.now();
  const date = new Date(timestamp);
  const year = date.getFullYear();
  const month = date.getMonth() + 1;
  const day = date.getDate();
  const hours = date.getHours();
  const minutes = date.getMinutes();
  const seconds = date.getSeconds();
  const formatNumber = (n) => n < 10 ? '0' + n : n;
  return `${year}-${formatNumber(month)}-${formatNumber(day)} ${formatNumber(hours)}:${formatNumber(minutes)}:${formatNumber(seconds)}`
}

exports.shouldDisplayTime = (prevTimestamp, currentTimestamp) => {
  const prevDate = new Date(prevTimestamp);
  const currentDate = new Date(currentTimestamp);
  const diff = currentDate - prevDate;
  const threeMinutesInMs = 5 * 60 * 1000;
  return diff > threeMinutesInMs ?  currentDate.toLocaleString() :  null;
}
  

